package com.cvo.scrumtoolkit.client.pannels.widgets;

import com.cvo.scrumtoolkit.client.entities.BacklogItem;
import com.cvo.scrumtoolkit.client.pannels.PopupWorkitemAanmaken;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

public class BacklogWidgetversusWorkItem extends Composite {

	private BacklogItem backlogItem;
	private static BacklogWidgetversusWorkItemUiBinder uiBinder = GWT
			.create(BacklogWidgetversusWorkItemUiBinder.class);

	interface BacklogWidgetversusWorkItemUiBinder extends
			UiBinder<Widget, BacklogWidgetversusWorkItem> {
	}
	@UiField
	Label lblindex;
	
	@UiField
	Label lblbacklogItem;
	
	@UiField
	Button btnbacklogItem;
	
	public BacklogWidgetversusWorkItem(BacklogItem backlogItem){
		initWidget(uiBinder.createAndBindUi(this));
		this.backlogItem=backlogItem;
		lblindex.setText(this.backlogItem.getIndex()+"");
		lblbacklogItem.setText(this.backlogItem.getBacklogItemName());
		btnbacklogItem.setText("Add");
		
	}
	
	
	@UiHandler("btnbacklogItem")
	void onclick(ClickEvent e) {
		PopupWorkitemAanmaken p = PopupWorkitemAanmaken.getPopup(backlogItem);
		RootPanel.get().add(p);
		RootPanel.get().setWidgetPosition(p,800, 400);
		p.setStyleName("main");
	}
	
	

}
